<%--
  Created by IntelliJ IDEA.
  User: 86186
  Date: 2025/6/29
  Time: 10:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
    <head>
        <title>用户列表</title>
        <script type="application/javascript" src="${pageContext.request.contextPath}/js/jquery-3.6.0.js"></script>
        <script type="application/javascript">
            $(function (){
                $("#btn").click(function (){
                    let param = {
                        name: "张三",
                        age: 18,
                    }
                    $.ajax({
                        type: "post",
                        url: "${pageContext.request.contextPath}/tree.action",
                        data: param,
                        success: function (res){
                            document.getElementById("divDemo").innerHTML = res.name;


                        },
                        error: function (xhr,status,error){
                            console.log("错误码:"+status.code+",错误信息:"+error);

                        }
                    })

                })
            })
        </script>

    </head>
    <body>
    <div>
        ${pageContext.request.contextPath}
    </div>
        <table border="1">
            <tr>
                <th>序号</th>
                <th>用户名</th>
                <th>性别</th>
            </tr>
            <c:forEach items="${userlist}" var="user" varStatus="status">
                <tr>
                    <td>${status.count}</td>
                    <td>${user.id}</td>
                    <td>${user.username}</td>
                    <td>${user.gender}</td>
                </tr>
            </c:forEach>
        </table>
        <div id="divDemo">

        </div>
        <input type="button" value="测试" id="btn" />

    </body>
</html>
